package ru.incoremedia.gwttest.core.client.form;

import com.google.gwt.rpcforms.client.dto.ProcessSubmitResult;
import ru.incoremedia.gwttest.core.client.component.ajaxloaderindicator.AjaxLoaderIndicator;
import com.google.gwt.rpcforms.client.handler.AsyncResultHandler;
import java.io.Serializable;
import com.google.gwt.rpcforms.client.form.RefreshForm;
import ru.incoremedia.gwttest.core.client.util.AsyncUtils;


public class MyRefreshForm extends RefreshForm {

    public MyRefreshForm(String controllerName) {
        super(controllerName);
    }

    @Override
    public void refresh(AsyncResultHandler<? extends Serializable> resultHandler) {
        AjaxLoaderIndicator.showModal();
        super.refresh(resultHandler);
    }

    @Override
    public void onSuccess(ProcessSubmitResult result) {
        super.onSuccess(result);
        AsyncUtils.onSucess();
    }

    @Override
    public void onFailure(Throwable t) {        
        super.onFailure(t);
        AsyncUtils.onFailure(t);
    }
}
